Skip to content

Defer closing the opened file when using FileScheme#1668

Merged
spiffcs merged 1 commit intoanchore:mainfrom
Noxsios:defer-file-close-on-source
Mar 15, 2023
Merged

Defer closing the opened file when using FileScheme#1668
spiffcs merged 1 commit intoanchore:mainfrom
Noxsios:defer-file-close-on-source

Conversation

@Noxsios
Copy link
Copy Markdown
Contributor

@Noxsios Noxsios commented Mar 14, 2023

On another project - https://github.com/defenseunicorns/zarf , I kept receiving the following error on our Windows build:

The process cannot access the file because it is being used by another process.

This error was thrown attempting to remove files that had been referenced by source.NewFromFile.

I believe the root cause is the dangling file reference in SetID. Linux/Mac are able to overcome this and can still remove the file, but Windows cannot.

Signed-off-by: razzle <harry@razzle.cloud>
@Noxsios Noxsios force-pushed the defer-file-close-on-source branch from 3f0044f to 846c9f7 Compare March 14, 2023 12:06
@spiffcs spiffcs merged commit 1d9ef34 into anchore:main Mar 15, 2023
@spiffcs
Copy link
Copy Markdown
Contributor

spiffcs commented Mar 15, 2023

Thanks for the catch here @Noxsios!

@Noxsios Noxsios deleted the defer-file-close-on-source branch March 15, 2023 19:32
spiffcs added a commit to deitch/syft that referenced this pull request Mar 21, 2023
* main: (47 commits)
  Deprecate config.yaml as valid config source; Add unit regression for correct config paths (anchore#1640)
  chore: Update syft bootstrap tools to latest versions. (anchore#1682)
  Update documentation: (anchore#1680)
  chore: Update Stereoscope to 7928713c391e20abaede6a029f4ce37b628a4c8b (anchore#1681)
  fix: reduce logging for bad dpkg lines (anchore#1675)
  fix ruby classifier (anchore#1678)
  feat: add shared dir for easier cleanup (anchore#1676)
  chore(deps): bump github.com/google/go-containerregistry (anchore#1672)
  chore(deps): bump actions/setup-go from 3 to 4 (anchore#1671)
  fix: move defer after error to protect panic case (anchore#1670)
  feat: add argocd, helm, kustomize and kubectl binary classifiers (anchore#1663)
  defer closing file (anchore#1668)
  fix: remove author contributing to javascript CPEs (anchore#1669)
  fix: more python matching support (anchore#1667)
  Update syft bootstrap tools to latest versions. (anchore#1666)
  feat: add ruby classifier (anchore#1665)
  Update syft bootstrap tools to latest versions. (anchore#1658)
  fix: improved Python binary detection (anchore#1648)
  fix: suppress some known incorrect vendor candidates for npm CPEs (anchore#1659)
  fix: sanitize SPDX LicenseRefs (anchore#1657)
  ...

Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
@spiffcs spiffcs added the bug Something isn't working label Mar 31, 2023
GijsCalis pushed a commit to GijsCalis/syft that referenced this pull request Feb 19, 2024
Signed-off-by: razzle <harry@razzle.cloud>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants